import React,{Component} from 'react'

export default function form (Comp){
  return class Wrapper extends Component{
    constructor(props){
      super(props)
      this.handleChange = this.handleChange.bind(this)
    }
    componentDidMount(){
      console.log(`高阶组件`)
    }
    handleChange(key, value){
      console.log(`高阶`, key, value)
      this.setState({
        [key]:value
      })
    }
    render(){
      return (
        <Comp
          {...this.props}
          state = {this.state}
          handleChange = {this.handleChange}
        ></Comp>
      )
    }
  }
}